package org.ocelot.tunes4j.dao;

import java.util.List;

import org.apache.ibatis.annotations.Delete;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Options;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.ocelot.tunes4j.beans.AudioObject;

public interface AudioObjectDAO {
	
	@Insert("INSERT INTO AUDIOOBJECT (id, album, artist, author, filename, genre, path, title, tracknumber, year1) " +
			"VALUES (#{id}, #{album:VARCHAR}, #{artist:VARCHAR}, #{author:VARCHAR}, #{fileName:VARCHAR}, #{genre:VARCHAR}, " +
			"#{path:VARCHAR}, #{title:VARCHAR}, #{trackNumber:VARCHAR}, #{year:VARCHAR})")
	public void insert(AudioObject audioObject);
	
	@Update("UPDATE AUDIOOBJECT SET album=#{album:VARCHAR},artist=#{artist:VARCHAR},author=#{author:VARCHAR}," +
			"filename=#{fileName:VARCHAR},genre=#{genre:VARCHAR},path=#{path:VARCHAR},title=#{title:VARCHAR}," +
			"tracknumber=#{trackNumber:VARCHAR},year1=#{year:VARCHAR} WHERE id = #{id}")
	public void update(AudioObject audioObject);
	
	@Select("SELECT * FROM AUDIOOBJECT WHERE id = #{id}")
	public AudioObject findById(int id);
	
	@Select("SELECT * FROM AUDIOOBJECT")
	public List<AudioObject> load();

	@Delete("DELETE FROM AUDIOOBJECT WHERE id = #{id}")
	public void remove(int id);

}
